﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/SystemManagement/Views/Shared/LigerUI.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <div style="padding: 100px 0 0 250px; ">
        <div id="login-box">
            <h2>
                Login</h2>
            Lorem Ipsum is simply dummy text of the printing and typesetting industry.
            <br />
            <br />
            <div class="login-box-name" style="margin-top: 20px;">
                账号：</div>
            <div class="login-box-field" style="margin-top: 20px;">
                <input name="loginusername" id="txtUsername" class="form-login" title="Username" value="zhuang" size="30" maxlength="2048" /></div>
            <div class="login-box-name">
                密码：</div>
            <div class="login-box-field">
                <input name="txtPassword" id="txtPassword" type="password" class="form-login" title="Password" value="123" size="30"
                    maxlength="2048" /></div>
            <br />
            <span class="login-box-options">
                <input type="checkbox" name="1" value="1" />
                Remember Me <a href="#" style="margin-left: 30px;">Forgot password?</a></span>
            <br />
            <br />
             <select id="moduleType" name="moduleType">
                 <option value="sys">系统管理</option>
                 <option value="cms">CMS后台管理</option>
            </select>
            <input type="submit" id="btnLogin" style=" float:right;width:50px" value="登陆" class="login-btn" />
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">

<style type="text/css">

#login-box {
	width:333px;
	height: 352px;
	padding: 58px 76px 0 76px;
	color: #ebebeb;
	font: 12px Arial, Helvetica, sans-serif;
	background: url(/Areas/SystemManagement/Images/login-box-backg.png) no-repeat left top;
}

#login-box img {
	border:none;
}

#login-box h2 {
	padding:0;
	margin:0;
	color: #ebebeb;
	font: bold 44px "Calibri", Arial;
}


.login-box-name {
	float: left;
	display:inline;
	width:80px;
	text-align: right;
	padding: 14px 10px 0 0;
	margin:0 0 7px 0;
}

.login-box-field {
	float: left;
	display:inline;
	width:230px;
	margin:0;
	margin:0 0 7px 0;
}


.form-login  {
	width: 205px;
	padding: 10px 4px 6px 3px;
	border: 1px solid #0d2c52;
	background-color:#1e4f8a;
	font-size: 16px;
	color: #ebebeb;
}


.login-box-options  {
	clear:both;
	padding-left:87px;
	font-size: 11px;
}

.login-box-options a {
	color: #ebebeb;
	font-size: 11px;
}

</style>


<script type="text/javascript">
    var FromUrl = '<%=Url.Action("Index","Index")%>';
    $(function () {

        $("#btnLogin").click(function () {
            var username = $("#txtUsername").val();
            var password = $("#txtPassword").val();
            var module=$("#moduleType option:selected").val();
            
            if (username == "") {
                alert('账号不能为空!');
                $("#txtUsername").focus();
                return;
            }
            if (password == "") {
                alert('密码不能为空!');
                $("#txtPassword").focus();
                return;
            }
            $.ajax({
                type: 'post', cache: false, dataType: 'json',
                url: '<%=Url.Action("Login","Login")%>',
                data: [
                    { name: 'username', value: username },
                    { name: 'password', value: password },
                    { name: 'module', value: module }
                    ],
                success: function (result) {
                    if (result!="") {
                        alert(result);
                        $("#txtUsername").focus();
                        return;
                    } else {
                        location.href = FromUrl;
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {

                    alert('发送系统错误,请与系统管理员联系!');
                },
                beforeSend: function () {
                    $("#btnLogin").attr("disabled", true);
                },
                complete: function () {
                    $("#btnLogin").attr("disabled", false);
                }
            });
        });
    });
    </script>
</asp:Content>
